perm filename S1[1,ALS] blob
sn#387803 filedate 1978-10-13 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00005 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 I have some comments regarding the S1 Architecture Manual. Having had no
C00009 00003 The following example illustrates this method by coercing N from
C00011 00004 (*PROGRAM HEADER PAGE*)
C00014 00005 PROGRAM MERGESORT(SORTFI*,FILE1*,FILE2,FILE3,FILE5)
C00022 ENDMK
C⊗;
I have some comments regarding the S1 Architecture Manual. Having had no
previous acquaintance with this machine, I may be simply revealing my own
ignorance rather than helping, but here are my comments anyway. In a few
cases I have been deliberately dumb to illustrαte deficiencies in the
explanations.
p 43 Instruction Descriptions
For completeness there should be a statement in this section regarding the
factors that determine the number of words that an instruction may occupy,
There might also be a statement for each individual instruction listing
the appropiate values, for example "This instruction may occupy 1, 2 or 3
words". These values would, of course, be for the presently intended
implementation and they might have to be changed later.
Many of the instruction descriptions contain the statement that "OP1 and
OP2 have the same precision as the modifier" or a similar statement. Do
you mean they will be assumed to have the same precision or that they must
have the same precision? I think I know what will happen if they refer to
locations that had been previously assumed to contain data of a different
precision but it would'nt hurt to be told.
p 23 par. 4.2 Integer
It might be wise at this point to add a statement to the effect that "for
certain types of instructions, notably the shift instructions, specific
instructions are provided to handle the two types of integers."
p 61 TRANS
What happens when OP2 is more precise than OP1?
Also, this should cross-refer to MOV on page 78.
p 78 MOV
The explanation under purpose is badly written. In the first place the
references to OP1 and OP2 are mixed up. Furthermore, even with this error
corrected, the explanation is imprecise, and gets tangled up in relating
what is done rather than telling what the end results are. Suppose for
example, that OP2 is a quarter word. Perhaps for simplcity, the
micro-code may be written so that the MOV instruction always zero-extends
the bit string from OP2 to a double word but the programmer hardly needs
to know this, at least at this point. But if he is to be told this then
you should not refer to the "low-order bits" of this double word in these
precise terms when the part stored may be a half-word, a single word, or
even the entire double-word. Finally, stating that OP2 is first
zero-extended seems to imply that OP2 is itself altered by the move
instruction. This a surely not so. What is extended is the string of
bits taked from OP2.
p 84 CMPSF-BNDSF
Are the operands to these instruction assumed to be signed or unsigned
integers? If signed should not the instruction name contain an "A"?
Shouldn't there be two types here, a CMPSF and a CMPSFA, for example?
The unsigned CMPSF would be very useful in sorting operations.
p97 ROT and ROTV
The distinction between logical and arithemetic is not made in these
instructions. Why not add the word "logically" before the word "rotated"
in the statements of purpose, if that is what is intended?
For completeness might it not be desirable to have ROTA and ROTAV
instructions as well? I do not at the moment know of a situation where
these would be useful and they may not be worth the bother, but they
should be considered.
p 130 BLKCMP
In the second par. of purpose it states that "Signed comparison is used
and each block element is compared separately". Just what does this mean?
Does it mean that each quarter-word is a block element and is individually
considered to be a signed integer, if a Q modifier is used, or is the entire
block considered to be a signed integer with bit 0 of the first word the sign?
Also, why allow signed comparisons without providing for unsigned comparisons?
Another related question but not properly directed to the manual as such--
Will there be a facility in PASCAL to utilize these block instructions?
These questions are promped by a review of the techniques that might be
available for sorts with large keys.
p164 NOP
Since the principal use of this instruction would seem to be to leave
space in the code for unused options or for subsequent insertions, one
needs to know how to fix the number of words it will occupy. Shouldn't
this information be given here?
The following example illustrates this method by coercing N from
single-word to 6-bit precision:
SHF.LF.S RTA,N,?1
XOR.S RTA,N
AND.S RTA,#⊂777777777600⊃
JMPZ.NEQ.S RTA,TOOBIG
My previous note re precision coercion actually coerced into a 7-bit
integer, not a 6-bit integer.
Guy Steele pointed out that a MOVABS followed by testing the high-order
bits for all-zero does fast *approximate* precision coercion.
Of course the easiest way to do exact precision coercion is to add a bias
to convert to excess notation, then test the high-order bits for zero.
To coerce a single-word into 7 bits:
ADD RTA,N,?100
SKP.ANY.S RTA,?777777777600,TOOBIG
This technique (as well as MOVABS) may overflow if the input can not be
coerced; my first method never overflows.
(*PROGRAM HEADER PAGE*)
(*PAS10 OPTIONS*) (* D+,R32*)
(* DEFAULT
D+ DEBUG AND POSTMORTEM DUMP -
E+ EXTERNAL CALLS TO LEVEL 1 PROCEDURES ALLOWED -
Fn FILE OPTION 1
I+ FORTRAN I/O IN EXTERNAL FORTRAN SUBROUTINES -
L+ OBJECT LISTING -
Rn SIZE OF LOW-SEGMENT (SEE PAS10 MANUAL)
Sn MAX INSTRUCTIONS PER STATEMENT 1000
T+ RUNTIME CHECK +
U+ 72 COLUMN FORMAT -
Xn HIGHEST REGISTER FOR PARAMETERS 6
*)
(*SLAC PCPASC OPTIONS*) (* B+,D+,M-*)
(* DEFAULT
A+ GENERATE 370 OBJECT MODULE -
A- GENERATE 370 ASSEMBLY MODULE
B+ BOUNDS CHECKING, BUT ALLOW 'BIG' CHARACTERS -
C+ EMIT PCODE +
D+ RUNTIME CHECKING OF POINTER, INDEX, SUBRANGE VALUES -
E+ FILE IS IN EBCDIC CHARACTER SET -
F+ SAVE FPR'S ON PROCEDURE/FUNCTION ENTRY +
K+ ENABLE STATEMENT EXECUTION COUNTING -
L+ LIST SOURCE PROGRAM +
M+ 72 COLUMN FORMAT +
P+ DOUBLE-WORD BOUNDARY ALIGNMENT -
S+ SAVE GPR'S ON PROCEDURE/FUNCTION ENTRY +
T+ PRINT SYMBOL TABLES (FOR POST-PROCESSOR) -
U+ GET STATISTICS?? 2ND PARAMETER TO PCODE BGN INSTR. -
V+ ?? 3RD PCODE BGN INSTRUCTION PARAMETER -
X+ USE ACTUAL PROCEDURE NAMES FOR EXTERNAL REFERENCES -
X- GENERATE UNIQUE 8-CHAR NAMES FOR EXTERNAL REFERENCES
*)
(*S1 PCPASC OPTION DIFFERENCES*) (*$A+,B+,D+,M-*)
(* DEFAULT
A+ GENERATE S1 ASSEMBLY MODULE -
A- GENERATE S1 OBJECT MODULE
*)
(* SLAC/PDP-10 TRANSPORT DEPENDENCIES FLAGGED WITH "XSL10" *)
(* PDP-10/S-1 TRANSPORT DEPENDENCIES FLAGGED WITH "X10S1" *)
PROGRAM MERGESORT(SORTFI*,FILE1*,FILE2,FILE3,FILE5);
CONST
MAXSORT= 2048;
MAXINDX= 2049;
TYPE
SORTINDX= 1..MAXINDX;
SORTITEM= INTEGER;
SORTARY= ARRAY [SORTINDX] OF SORTITEM;
VAR
SORTFI,FILE1,FILE2,FILE3,FILE4: TEXT OF ASCII;
A: SORTARY;
B: SORTARY;
C: SORTARY;
(**********************************************************************)
PROGRAM QUICKSORT(OUTPUT);
(**********************************************************************)
CONST
MAXSORT= 8000;
MAXINDX= 8001;
MAXSTACK= 200;
M= 9;
INFINITY= 2147483647;
TYPE
SORTINDX= 0 .. MAXINDX;
SORTITEM= INTEGER;
SORTARY= ARRAY [SORTINDX] OF SORTITEM;
VAR
A: SORTARY;
(**********************************************************************)
(*
PROCEDURE WRTINT(I,LEN: INTEGER);
VAR
POW10: INTEGER;
NEG: BOOLEAN;
DIGS: INTEGER;
TMP: INTEGER;
BEGIN
NEG:=FALSE;
IF I<0 THEN BEGIN
LEN:=LEN-1;
NEG:=TRUE;
I:=-I;
END;
DIGS:=0;
TMP:=I;
POW10:=1;
REPEAT
TMP:=TMP DIV 10;
POW10:=POW10*10;
DIGS:=DIGS+1;
UNTIL TMP=0;
FOR TMP:=LEN DOWNTO DIGS DO BEGIN
WRITE(' ');
END;
IF NEG THEN BEGIN
WRITE('-');
END;
REPEAT
POW10:=POW10 DIV 10;
TMP:=I DIV POW10;
WRITE(CHR(TMP+ORD('0')));
I:=I MOD POW10;
UNTIL POW10=1;
END;
*)
(**********************************************************************)
PROCEDURE INITARY(VAR ARY: SORTARY);
CONST
A= 54321;
C= 0;
M= 59999;
VAR
I: SORTINDX;
RAND: INTEGER;
BEGIN
RAND:=12345;
FOR I:=1 TO MAXINDX DO BEGIN
RAND:=((A*RAND+C) MOD M);
ARY[I]:=RAND;
END;
END;
(**********************************************************************)
(*
PROCEDURE PRTARY(VAR A: SORTARY);
VAR
I: SORTINDX;
BEGIN
FOR I:=1 TO MAXSORT DO BEGIN
WRTINT(A[I],12);
WRITELN(OUTPUT);
END;
WRITELN(OUTPUT);
END;
*)
(**********************************************************************)
PROCEDURE SORT(VAR A: SORTARY);
LABEL 1,2,3,4,5,6;
VAR
P,
L,
R,
I,
J,
T: INTEGER;
TMP,
V: SORTITEM;
STACK: ARRAY [0 .. MAXSTACK] OF INTEGER;
BEGIN
A[0]:=-INFINITY;
A[MAXSORT+1]:=INFINITY;
P:=0; L:=1; R:=MAXSORT;
1:
I:=L; J:=R+1; V:=A[L];
WHILE I<J DO BEGIN
I:=I+1; WHILE A[I]<V DO I:=I+1;
J:=J-1; WHILE A[J]>V DO J:=J-1;
TMP:=A[J];
A[J]:=A[I];
A[I]:=TMP;
END;
TMP:=A[J];
A[J]:=A[L];
A[L]:=A[I];
A[I]:=TMP;
IF (R-J)>(J-L) THEN GOTO 3;
IF (J-L)<=M THEN GOTO 5;
IF (R-J)<=M THEN GOTO 4;
P:=P+2;
STACK[P]:=L;
STACK[P+1]:=J-1;
2:
L:=J+1;
GOTO 1;
3:
IF (R-J)<=M THEN GOTO 5;
IF (J-L)<=M THEN GOTO 2;
P:=P+2;
STACK[P]:=J+1;
STACK[P+1]:=R;
4:
R:=J-1;
GOTO 1;
5:
L:=STACK[P];
R:=STACK[P+1];
P:=P-2;
IF P>=0 THEN GOTO 1;
6:
FOR I:=2 TO MAXSORT DO BEGIN
V:=A[I];
J:=I-1;
WHILE A[J]>V DO BEGIN
A[J+1]:=A[J];
J:=J-1;
END;
A[J+1]:=V;
END;
END;
(**********************************************************************)
BEGIN
RESET(FILEFI);
FILE1:=GETFILENAME(SORTFI);
FILE2:=GETFILENAME(SORTFI);
SORT(A);
END.
(**********************************************************************)